import {customeStruct} from '../utils';
const itf = customeStruct.interface;

export const InitDataStruct = itf({
    payload: itf({
        brands: [itf(Object.assign({
            id: 'string',
            code: 'string',
            name: 'string',
        }))],
        partSaleOrderTypes: [itf(Object.assign({
            id: 'string',
            typeCode: 'string',
            typeName: 'string',
        }))],
    })
});

const content = {
    id: 'string',
    code: 'string',
    transferOrderCode: 'string? | null',
    deliveryCode: 'string? | null',
    partOrderCode: 'string? | null',
    brandCode: 'string? | null',
    dealerCode: 'string? | null',
    partOrderTypeName: 'string? | null',
    transportType: 'number? | null',
    pickingType: 'number? | null',
    itemCount: 'number? | null',
    pickingQuantityCount: 'number? | null',
    createTime: 'datetime? | null'
};

export const List = itf({
    payload: itf({
        content: [itf(Object.assign(content))]
    })
});

export const Detail = itf({
    payload: itf({
        id: 'string',
        code: 'string',
        transferOrderCode: 'string? | null',
        deliveryCode: 'string? | null',
        partOrderCode: 'string? | null',
        brandCode: 'string? | null',
        dealerCode: 'string? | null',
        partOrderTypeName: 'string? | null',
        transportType: 'number? | null',
        pickingType: 'number? | null',
        itemCount: 'number? | null',
        pickingQuantityCount: 'number? | null',
        createTime: 'datetime? | null',
        details: [
            itf({
                partId: 'string',
                partCode: 'string',
                partName: 'string',
                oldPartId: 'string? | null',
                oldPartCode: 'string? | null',
                oldPartName: 'string? | null',
                pickingQuantity: 'number? | null',
                packedQuantity: 'number? | null',
                approvedQuantity: 'number? | null',
                price: 'number? | null',
                pickedTotalAmount: 'number? | null',
                packedTotalAmount: 'number? | null'
            })
        ]
    })
});

export const DeliveryList = itf({
    payload: itf({
        content: [itf(Object.assign({
            id: 'string',
            sapDeliveryCode: 'string? | null',
            sapTransferOrderCode: 'string? | null',
            partSaleOrderCode: 'string? | null',
            partOrderTypeName: 'string? | null',
            dealerCode: 'string? | null',
            code: 'string? | null',
        }))],
    })
});
const dealer = {
    id: 'string',
    code: 'string',
    name: 'string'
};

export const DealerList = itf({
    payload: itf({
        content: [itf(dealer)]
    })
});

export const DealerSimpleList = itf({
    payload: itf({
        content: [
            itf({
                id: 'string',
                code: 'string',
                name: 'string'
            })
        ]
    })
});
